<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1"><title id="aw20941">ALTER SCHEMA</title><body><p id="sql_command_desc">Changes the definition of a schema.</p><section id="section2"><title>Synopsis</title><codeblock id="sql_command_synopsis">ALTER SCHEMA <varname>name</varname> RENAME TO <varname>newname</varname>

ALTER SCHEMA <varname>name</varname> OWNER TO <varname>newowner</varname></codeblock></section><section id="section3"><title>Description</title><p><codeph>ALTER SCHEMA</codeph> changes the definition of a schema. </p><p>You must own the schema to use <codeph>ALTER SCHEMA</codeph>. To rename
a schema you must also have the <codeph>CREATE</codeph> privilege for
the database. To alter the owner, you must also be a direct or indirect
member of the new owning role, and you must have the <codeph>CREATE</codeph>
privilege for the database. Note that superusers have all these privileges
automatically.</p></section><section id="section4"><title>Parameters</title><parml><plentry><pt><varname>name</varname></pt><pd>The name of an existing schema. </pd></plentry><plentry><pt><varname>newname</varname></pt><pd>The new name of the schema. The new name cannot begin with <codeph>pg_</codeph>, as such names
            are reserved for system schemas. </pd></plentry><plentry><pt><varname>newowner</varname></pt><pd>The new owner of the schema.</pd></plentry></parml></section><section id="section5"><title>Compatibility</title><p>There is no <codeph>ALTER SCHEMA</codeph> statement in the SQL standard.
</p></section><section id="section6"><title>See Also</title><p><codeph><xref href="./CREATE_SCHEMA.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="./DROP_SCHEMA.xml#topic1" type="topic" format="dita"/></codeph></p></section></body></topic>
